<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>投股王</title>
    <link href="__PUBLIC__/weChat/css/base.css" rel="stylesheet" type="text/css">
    <link href="__PUBLIC__/weChat/css/style.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/weChat/css/media.css"/>
    <style>
        .warp{height: 100vh;width: 100%;}
        /*头部样式*/
        .head{background: #fff;position: absolute;}
        .head_top{height: 95px;width: 100%;}
        .head_top>a>img{width: 100%;}
        .head_title{height: 55px;padding: 10px 10px 5px;width: 100%;box-sizing: border-box;}
        .head_title_left{float: left;}
        .head_title_right{overflow: hidden;text-align: right;font-size: 12px;height: 100%;box-sizing: border-box;}
        .head_title_time{font-size: 11px;height:18px;}
        .head_title_time>img{height:100%;padding-right: 5px;vertical-align: middle;}
        .head_title_time>span{vertical-align: middle;}
        .head_title_name>span>a{display: inline-block;}
        .head_title_name>span>a>img{width: 15px;}
        .btn_sign{width: 42px;height: 22px;background: #ff8053;border-radius: 5px;color:#fff;display: inline-block;line-height: 22px;text-align: center;z-index: 110;position: relative;}

        /*直播文字部分*/
        .content{}
        .content_box{background: #eeeeee;padding: 155px 10px 36px;height: 100%;box-sizing: border-box;overflow: auto;}
        .chat_list{padding: 8px 5px;background: #ffffff;margin-bottom: 5px;}
        .chat_list_title{padding-bottom: 5px;}
        .chat_list_title>span{display: inline-block;vertical-align: middle;}
        .chat_list_time{color:#e7241e;font-size: 14px;background: url("images/icon_y@2x.png") no-repeat left;padding-left: 10px;background-size: 7px;margin-left: 5px;}
        .chat_list_img{width: 35px;padding: 0 5px 0 12px;}
        .chat_list_img>img{width: 100%;}
        .chat_list_content>img{max-width: 100%;}


        /*浮动层*/
        .float_layer{position: fixed;right: 0;top: 30%;width: 51px;height: 166px;border-radius: 5px;background: rgba(175,175,175,0.5);z-index: 100;}
        .layer_item{padding-top: 10px;}
        .layer_item>a{display: block;}
        .layer_item>a{font-size: 9px;color:#ff5f26;font-weight: bold;text-align: center;width: 100%;display: inline-block;padding-top: 27px;}
        .layer_item1{position: relative;z-index: 110;}
        .layer_item_a1{background: url("__PUBLIC__/weChat/images/icon_yg@2x.png") no-repeat top;background-size: 50%;}
        .layer_item_a2{background: url("__PUBLIC__/weChat/images/icon_tj@2x.png") no-repeat top;background-size: 50%;}
        .layer_item_a3{background: url("__PUBLIC__/weChat/images/icon_kf@2x.png") no-repeat top;background-size: 50%;}

        /*聊天直播框*/
        .chat_live{height: 36px;border-top: 1px solid #8e8e8e;position: fixed;bottom: 0;width: 100%;background: #ffffff;padding: 0 10px;line-height: 36px;}
        .chat_live_name{float: left;font-size: 12px;width: 40px;margin-right: 10px;text-align: center;}

        /*弹窗*/
        .popup_inner{width: 170px;height: 111px;background: #fff;border-radius: 5px;margin: 50% auto;text-align: center;padding-top: 5px;}
        .popup_inner>div{font-size: 15px;line-height: 33px;height: 33px;}
        .popup_inner>span{height: 34px;line-height: 34px;border-top: 1px solid #e3e3e3;display: block;margin-top: 10px;}
        .popup_inner>div>span{font-size: 24px;color:#D02100;}
        .first_inner>img{display: block;}
        .first_inner{width: 60%;position: absolute;top: 140px;left: 25%;}
        .pic_one{width: 41px;margin-bottom: 10px;}
        .pic_two{width: 141px;}
        .pic_three{width: 43px;position: absolute;right: 0;top:0;}
        .pic_four{width: 135px;margin-top: 38px;}
        .two_inner{position: absolute;top:43%;left: 20%;width: 60%;}
        .two_pic1{width: 52px;display: block;margin-left: 10px;}
        .two_pic2{width: 155px;}
        .two_pic3{width: 73px;position: absolute;top: 0;}
        .two_pic4{width: 135px;margin-top: 38px;margin-left: 5px;}
        .three_inner{position: absolute;top:40%;left: 10%;width: 85%;}
        .three_pic1{width: 42px;margin-left: 20px;margin-bottom: 5px;}
        .three_pic2{width: 255px;}
        .three_pic3{width: 56px;position:absolute;right: 0;top: 0;}
        .three_pic4{width: 135px;margin-top: 38px;margin-left:24%;}
        .four_inner{position: absolute;bottom: 15%;left: 20%;}
        .four_pic1{width: 45px;display: block;margin-left: 24px;margin-bottom: 5px;}
        .four_pic2{width: 187px;display: block;}
        .four_pic3{width: 43px;position: absolute;bottom: -40px;left: -44px;}
        .four_pic4{width: 135px;margin-bottom: 38px;margin-left:24%;}
        .shadow{-moz-box-shadow:0px 0px 18px #FFFFFF; -webkit-box-shadow:0px 0px 18px #FFFFFF; box-shadow:0px 0px 18px #FFFFFF;}
        /*客服*/
        #UDESK_BTN{display:none;}
        #udesk_btn a{/* margin-bottom: 280px;*/margin-right:16px;top:45%;width: 50px!important;height: 50px!important;border: none!important; background-color: #FFFFFF!important;; background: url(img/icon_kf@2x.png)no-repeat;z-index: 1000000; background-size:50px 50px; background-position:55%;}
        #udesk_btn a span{background-image:none!important;}
        #bgl{ width:100%;height:100%;background:rgba(0,0,0,0.5);position:fixed;/*固定定位*/left:0;top:0;display:none; z-index: 999;}
        #copy-right{display:none!important;}
        #header{display:none!important;}
        #udesk_btn_text{display: none!important;}
        .icon--11{width: 100%;height:35px;z-index:11111111111111111111;position: fixed;bottom: 0;background-color: #ffbe22;}
        .icon-ft{width: 100%;height: 100%;}
        .icon--12{width:40px;height: 40px;background-color: #FFBE22;position:fixed;z-index:11111111111111111111;top:2%;right:2%;}
        .icon--del{width:27px;height:27px;}
        /*签到*/
       .background1{position:fixed;width:100%;height:100%; z-index:1111111111111111111; top:0;left:0; background:rgb(50,50,50); background:rgba(0,0,0,0.5);}
       #content4{width:100%;height: 50%;top:22%;z-index:11111111111111111111;position:fixed;box-sizing:border-box;overflow:hidden;zoom:1;text-align:center;}
		.all-del{float: right;margin-bottom:-10%;width: 30px;height:30px;z-index: 111;position: relative;}
		.qdjf-box{width:68%;height:65%;margin:0 auto;position:relative;}
		.icon_qdcg{height:188px;width:238px;position: relative;z-index:1;}
		.qdpp{position:absolute;color: #FFFFFF;top:62%;left:38%;z-index: 2;}
		.qdpp span{color:#E7241E;font-size:1.4em;font-weight:600;}
  </style>
</head>
<body>
    <div class="warp">
        <div class="head">
            <div class="head_top">
                <a href="<?php echo url('play/play')?>">
                    <img src="__PUBLIC__/weChat/images/movie_pic1.png"/>
                </a>
            </div>
            <div class="head_title">
                <div class="head_title_left">
                    <div class="head_title_name"><span><?php echo $user_info['nickname']?></span>
                        <span>
                            <a href="javascript:void (0)" id="person_center"><img src="__PUBLIC__/weChat/images/icon_xg@2x.png"/></a>
                        </span>
                    </div>
                    <div class="head_title_time font3"><img src="<?php if(empty($user_info['username'])){ echo '__PUBLIC__/weChat/images/icon_yk@2x.png';}if(!empty($user_info['username'])){ echo '__PUBLIC__/weChat/images/icon_hy@2x.png';}?>" /><span>
                        <?php echo empty($user_info['validity']) ? '' : $user_info['validity'].'过期'?></span></div>
                </div>
                <div class="head_title_right">
                    <div class="font1"><span class="integral_cont"><?php echo $user_info['integral']?></span><span id="sou">积分</span></div>
                    <span class="btn_sign shadow" id="btn_sign">签到</span>
                </div>
            </div>
        </div>
        <div class="content_box">
            <div class="content">

            </div>
        </div>
        <div class="float_layer">
            <div class="layer_item">
                <a class="layer_item_a1" href="<?php echo url('notice/notice')?>">直播预告</a>
            </div>
            <div class="layer_item layer_item1">
                <a class="layer_item_a2" href="javascript:void (0);">牛股推荐</a>
            </div>
            <div class="layer_item">
                <a class="layer_item_a3" href="javascript:void (0);">联系客服</a>
            </div>
            <div class="two_popup popup hide1">
                <div class="two_inner">
                    <img class="two_pic1" src="__PUBLIC__/weChat/images/icon_star@2x.png"/>
                    <img class="two_pic2" src="__PUBLIC__/weChat/images/icon_mrngtj@2x.png"/>
                    <img class="two_pic3" src="__PUBLIC__/weChat/images/icon_mrngjt@2x.png"/>
                    <img class="two_pic4" src="__PUBLIC__/weChat/images/icon_next@2x.png"/>
                </div>
            </div>
        </div>
        <div class="chat_live">
            <div class="chat_live_name font4 over_point"></div>
            <div class="chat_live_content font1 over_point">当前没有人在聊天</div>
        </div>
        <div class="first_popup popup <?php
        if(!empty($param['first_login'])){
            echo $param['first_login'] == 1 ? '' : 'hide1';
        }else{
            echo 'hide1';
        }
       ?>">
            <div class="first_inner">
                <img class="pic_one" src="__PUBLIC__/weChat/images/icon_king@2x.png"/>
                <img class="pic_two" src="__PUBLIC__/weChat/images/icon_qddjf@2x.png"/>
                <img class="pic_three" src="__PUBLIC__/weChat/images/icon_qdjt@2x.png"/>
                <img class="pic_four" src="__PUBLIC__/weChat/images/icon_next@2x.png"/>
            </div>
        </div>
        <div class="three_popup popup hide1">
            <div class="three_inner">
                <img class="three_pic1" src="__PUBLIC__/weChat/images/icon_cafe@2x.png"/>
                <img class="three_pic2" src="__PUBLIC__/weChat/images/icon_wzzbwz@2x.png"/>
                <img class="three_pic3" src="__PUBLIC__/weChat/images/icon_wzzbjt@2x.png"/>
                <img class="three_pic4" src="__PUBLIC__/weChat/images/icon_next@2x.png"/>
            </div>
        </div>
        <div class="four_popup popup hide1">
            <div class="four_inner">
                <img class="four_pic4" src="__PUBLIC__/weChat/images/icon_know@2x.png"/>
                <img class="four_pic1" src="__PUBLIC__/weChat/images/icon_oh@2x.png"/>
                <img class="four_pic2" src="__PUBLIC__/weChat/images/iocn_ltnrwz@2x.png"/>
                <img class="four_pic3" src="__PUBLIC__/weChat/images/icon_ltnrjt@2x.png"/>
            </div>
        </div>
        <div class="hide1 popup everyday">
            <div class="popup_inner" style="position: relative;">
                <img style="width: 20px;height: 20px;position: absolute;right: 0;top: -20px;" onclick="closeEveryday()" src="__PUBLIC__/weChat/images/icon_c@2x.png"/>
                <div>牛股推荐领取成功</div>
                <div class="msg no_login_msg">扣除<span>5</span>积分</div>
                <span class="cursor"  onclick="everySure()">确定</span>
            </div>
        </div>
        <div class="prompt_box" id="error"  style="display: none ">
            <img src="__PUBLIC__/weChat/images/icon_gth@2x.png"  class="icon_gth" alt="">
            <span class="prompt_span" id="errmsg"></span>
        </div>
        <div id="suc" class="hide1 popup error">
            <div class="popup-inner">
                <img class="close" data-name="error" src="__PUBLIC__/home/images/icon_delete1.png" />
                <div class="errorImg"><img  src="__PUBLIC__/home/images/icon_cg.png"></div>
                <div class="msg" id="sucmsg"></div>
            </div>
        </div>
    </div>
    <div class="icon--11 hide1"></div>
    <div class="icon--12 hide1"><img class="icon--del" src="__PUBLIC__/weChat/images/icon_c@2x.png"/></div>
     <div  class="background1 hide1"></div>
         <div id="content4" class="hide1">        	
         	<div class="qdjf-box">
         	  <img class="all-del" onclick="closeCon4()" src="__PUBLIC__/weChat/images/icon_close@2x.png"/>
         	  <img class="icon_qdcg" src="__PUBLIC__/weChat/images/icon_qdcg@2x.png"/>
         	  <p class="qdpp">积分<span>+5</span></p>
         	</div>         	
     </div>
<script src="__PUBLIC__/weChat/js/jquery-2.2.2.js"></script>
<script src="__PUBLIC__/weChat/js/base.js"></script>

<script>
     function closeCon4(){
     	$('.background1').hide();$('#content4').hide();
     };
     function closeEveryday(){
       $(".everyday").hide();
     };
    $(function () {
       $(".pic_four").click(function () {
           $(".first_popup").hide();
           $(".btn_sign").css("z-index",0).removeClass("shadow");
           $(".layer_item1").css("z-index",110).addClass("shadow");
           $(".two_popup").show();
       }) ;
        $(".two_pic4").click(function () {
            $(".two_popup").hide();
            $(".layer_item1").css("z-index",0).removeClass("shadow");
            $(".chat_list").eq(0).css({
                "z-index":110,
                "position":"relative"
            }).addClass("shadow");
            $(".three_popup").show();
        }) ;
        $(".three_pic4").click(function () {
            $(".three_popup").hide();
            $(".chat_list").eq(0).css({
                "z-index":0
            }).removeClass("shadow");
            $(".chat_live").css({
                "z-index":110
            }).addClass("shadow");
            $(".four_popup").show();
        }) ;
        $(".four_pic4").click(function () {
            $(".four_popup").hide();
            $(".chat_live").css({
                "z-index":10
            }).removeClass("shadow");
        }) ;

        $(".layer_item_a2").click(function () {
            var is_deduction_integral = "<?php echo empty($is_deduction_integral)? 0 : $is_deduction_integral?>";
            console.log(is_deduction_integral);
            if(is_deduction_integral == 'is_not_deduction_integral'){
                location.href = "<?php echo url('shares/shares')?>";
            }
            if(is_deduction_integral == 'is_deduction_integral'){
                $(".everyday").show();
            }
        });
        liveContent();
        chatContent();
    });

    //聊天开始
    ws = new WebSocket("ws://139.196.38.101:2346");
    ws.onopen = function() {
        console.log('连接成功');
    }
    //主要接受管理员推送的审核通过的数据
    ws.onmessage = function(e) {
        var message=JSON.parse(e.data);
        console.log(message)
        if(message.status==1){
            $(".chat_live_name").html(message.nickname);
            $(".chat_live_content").html(message.content);
        };
    };
    //聊天结束

    //        获取文字直播内容
    function liveContent(){
        $.ajax({
            url:"http://zbstest.guochengic.com/home/chat/getTextChat",
            type:"POST",
            success: function (res) {
                var html="";
                console.log(res)
                if(res.code==0){
                    for (var i=0;i<res.data.length;i++){
                        var messageData=res.data[i];
                        var message=JSON.parse(messageData.content);
                        html+="<div class='chat_list'>"+
                                "<div class='chat_list_title'>"+
                                "<span class='chat_list_time'>"+message.sendTime+"</span>"+
                                "<span class='chat_list_img'><img src='__PUBLIC__/weChat/images/icon_zl@2x.png'></span>"+
                                "<span>"+message.nickname+"</span>"+
                                "</div>"+
                                "<div class='chat_list_content'>"+message.content+
                                "</div>"+
                                "</div>";
                    }
                    $(".content").html(html);
                }
            }
        })
    };

    //        获取聊天直播内容
    function chatContent(){
        $.ajax({
            url:"http://zbstest.guochengic.com/home/Chat/getChat",
            type:"POST",
            success: function (res) {
                console.log(res)
                if(res.code==0){
                    if(res.data.is_verify.length<=0){
                        return false;
                    }
                    var messageData=res.data.is_verify[0];
                    var message=JSON.parse(messageData.content);
                    if(messageData.status==1){
                        $(".chat_live_name").html(message.nickname);
                        $(".chat_live_content").html(message.content);
                    };
                }
            }
        })
    };
    /*确认扣除积分*/
    function everySure(){
        $.ajax({
            url:"http://zbstest.guochengic.com/home/integral/decIntegral",
            type:"POST",
            success: function (res) {
                if(res.code==0){
                    location.href = "<?php echo url('shares/shares')?>";
                }else if (res.code==10011){
                    location.href = "<?php echo url('user/register')?>";
                }else {
                    console.log(res)
                    $("#error").show();
                    $("#errmsg").html(res.msg);
                    errorHide();
                    return;
                }
            }
        });
    };

    /**
     * 用户签到
     */
    $(".btn_sign").click(function(){
        if(!$(".first_popup").hasClass("hide1")&& $(".first_popup").css("display")!="none" ){
            return;
        }
        //验证用户是否绑定过手机号
        $.ajax({
            type:'post',
            url:"<?php echo url('user/checkBand')?>",
            success:function(res){
                if(res.code == 0 ){
                    if(res.data.is_bind == 1){
                        $.ajax({
                            url:"http://zbstest.guochengic.com/home/integral/incIntegral",
                            type:"POST",
                            success: function (res) {
                                if(res.code==0){
                                    $(".integral_cont").text(res.data.integral.integral);
                                    $('.background1').show();$('#content4').show();                                  
                                    return;
                                }else {
                                    $("#error").show();
                                    $("#errmsg").html(res.msg);
                                    errorHide();
                                    return;
                                }
                            }
                        })
                    }
                    if(res.data.is_bind == 2){
                        location.href = "<?php echo url('user/register')?>";
                    }
                }
            }
        });

    });

    $("#person_center").click(function(){
        $.ajax({
            type:'post',
            url:"<?php echo url('user/checkBand')?>",
            success:function(res){
                //绑定过的用户
                if(res.data.is_bind == 1){
                    location.href = "<?php echo url('person/person')?>";
                }
                //未绑定过的用户
                if(res.data.is_bind == 2){
                    location.href = "<?php echo url('user/register')?>";
                }
            }
        });

    });
</script>
    <script>
        (function(a,h,c,b,f,g){
            a["UdeskApiObject"]=f;
            a[f]=a[f]||function(){
                        (a[f].d=a[f].d||[]).push(arguments)};
            g=h.createElement(c);
            g.async=1;
            g.src=b;
            c=h.getElementsByTagName(c)[0];
            c.parentNode.insertBefore(g,c)})
        (window,document,"script","//assets-cli.udesk.cn/im_client/js/udeskApi.js?1490946450362","ud");
        ud({"code":"16fk1621","link":"//weipan.udesk.cn/im_client?web_plugin_id=23439",
            "isInvite":true,
            "manueInit":false,
            "mobile":{
                "mode":"inner",
                "color":"#307AE8",
                "pos_flag":"crb",
                "onlineText":"联系客服，在线咨询",
                "offlineText":"客服下班，请留言",
                "pop":{"direction":"top",
                    "arrow":{"top":0,"left":"70%"}
                },
            },
            "mode":"inner",
            "color":"#307AE8",
            "background":"#ffbe22",
            "pos_flag":"srb",
            "onlineText":"联系客服，在线咨询",
            "offlineText":"客服下班，请留言",
            "targetSelector":".layer_item_a3",
            "onReady": function () {
                console.log("初始化完成")
                $(".icon--del").click(function () {
                    ud.hidePanel();
                    $(".icon--11").hide();
                     $(".icon--12").hide();
                })
            },
            "panel":{
                "css": {
                    "top": "0%",
                    "left": "0"
                }
            },
            "pop":{"direction":"top","arrow":{"top":0,"left":"80%"}}

        });
        $(function(){
            $(".layer_item_a3").click(function () {
                $(".icon--11").show();
                $(".icon--12").show();
            })
        })

    </script>
</body>
</html>